//
//  LNMainViewController.m
//  FBSnapshotTestCase
//
//  Created by 陆宁 on 2019/12/25.
//

#import "LNMainViewController.h"
#import "LNHomeServiceProtocol.h"
#import "LNMineServiceProtocol.h"
#import "LNMainServiceProtocol.h"
@interface LNMainViewController ()
@property(nonatomic,strong) NSMutableArray *registerViewControllers;

@end

@implementation LNMainViewController

//- (void)viewDidLoad {
//    [super viewDidLoad];
//    UIViewController * vc1 = [[BeeHive shareInstance] createService:@protocol(LNHomeServiceProtocol)];
//    UINavigationController * nc1 = [[UINavigationController alloc]initWithRootViewController:vc1];
//    nc1.title = @"首页";
//
//    UIViewController * vc2 = [[BeeHive shareInstance] createService:@protocol(LNMineServiceProtocol)];
//    UINavigationController * nc2 = [[UINavigationController alloc]initWithRootViewController:vc2];
//    nc2.title = @"我的";
//
//    self.viewControllers = @[nc1,nc2];
//
//}

-(instancetype)init
{
    self = [super init];
    if (self) {
        self.registerViewControllers = [[NSMutableArray alloc] initWithCapacity:1];
        
        id<LNHomeServiceProtocol> v4 = [[BeeHive shareInstance] createService:@protocol(LNHomeServiceProtocol)];
        if ([v4 isKindOfClass:[UIViewController class]]) {
            [self registerViewController:(UIViewController *)v4 title:@"埋点3" iconName:nil];
        }
        
        
        id<LNMineServiceProtocol> v2 = [[BeeHive shareInstance] createService:@protocol(LNMineServiceProtocol)];
        if ([v2 isKindOfClass:[UIViewController class]]) {
            [self registerViewController:(UIViewController *)v2 title:@"交易2" iconName:nil];
        }
        
    }
    
    return self;
}
- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    sleep(1);
    
    
}

-(void)registerViewController:(UIViewController *)vc title:(NSString *)title iconName:(NSString *)iconName
{
    vc.tabBarItem.image = [UIImage imageNamed:[NSString stringWithFormat:@"Home.bundle/%@", iconName]];
    vc.tabBarItem.title = title;
    
    [self.registerViewControllers addObject:vc];
    
    self.viewControllers = self.registerViewControllers;
}



/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
